<!DOCTYPE html>
<html>
<head>
<title>Welcome to LDM!</title>
    <head>
        <meta charset="utf-8">
        <!-- 告诉浏览器网页所识别的文件类型及语言类型 -->
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>登录</title>
        <!-- 让一些搜索引擎搜索到你的网页 -->
        <meta name="description" content="">
        <meta name="keywords" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="external nofollow" >
        <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
        <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
        <script src="https://cdn.bootcss.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>
        <style>
            .carousel-inner img {
                width:100%;
                height:100%;
            }
            .jumbotron {
                margin-top: 10px;
                margin-bottom: 0px;
                padding-top: 10px;
            }
            #demo {
                width:100%;
                height: 500px;
            }
            .row {
                height: 264px;
            }
            .left {
                float: left;
                width: 70%;
            }
            .right {
                float: left;
                width: 30%;
            }
            .card {
                height: 340px;
            }
            .carousel-inner {
                height: 500px;
            }
            .footer {
                position: absolute;
                bottom: 0;
                height: 60px;
            }
            .jumheight1 {
                height: 100px;
            }
            .jumheight2 {
                height: 100px;
            }
            .end_name {
                margin-bottom: 5px;
            }
            .footer2 {
                padding-top: 210px;
                text-align: center;
            }
            .test{
                margin-bottom: 75px;
            }
            .carousel-control-prev,
            .carousel-control-next{
                bottom: 120px;
            }
        </style>
    </head>
</head>
<body>
<h1 id="myContent">Welcome to LDM!</h1>

</body>
<script>

    function getCookie(name)
    {
        var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
        if(arr=document.cookie.match(reg))
            return unescape(arr[2]);
        else
            return null;
    }




    window.onload=function (ev) {
        var token = getCookie("token");

        $.ajax({
            type : "GET",
            url : '/api/user/info/'+token,
            xhrFields:{
                withCredentials:true
            },
            success : function(ret){

                if(ret.success){
                    var h1=document.getElementById("myContent");
                    console.log(h1.innerText);
                    h1.innerText=ret.data+" Welcome to LDM!";
                }else{
                    alert(ret.msg);
                }
            }
        });
    }


</script>
</html>
